﻿@using Pay.Core;
@{
    ViewBag.Title = "订单管理";
    Layout = "~/Views/Shared/_MallLayout.cshtml";
    int isOnlyShowDistribution = ViewBag.IsOnlyShowDistribution;
    var expressList = ViewBag.ExpressList as List<DropdownItem>;
    int type = 0; //0 商品 1 集市
    string types = Request["type"] == null ? "0" : Request["type"].ToString();
    int.TryParse(types, out type);
}

<body class="page-order page-orderAdmin">
    <!--header end-->
    <div class="mescroll" id="mescroll">
        <div class="mod-type">
            <ul id="status">
                <li class="cur" value="0">全部<i></i></li>
                <li value="1">待支付<i></i></li>
                <li value="2">待发货<i></i></li>
                <li value="3">待收货<i></i></li>
                <li value="4">已完成<i></i></li>
                <li value="5">已关闭<i></i></li>
            </ul>
        </div>
        <div class="">
            <div id="order" class="mod-shoppingCart"></div>
        </div>
    </div>
    @if (isOnlyShowDistribution == 1) {
        <!-- 底部导航 -->
        <div class="lt-footNav">
            <ul>
                <li>
                    <a href="@Url.Action("Index","DistributionMall")">
                        <i class="icon-footNav1"></i>
                        <p>首页</p>
                    </a>
                </li>
                <li class="cur">
                    <a href="/MyOrder/SellerOrderList?isOnlyShowDistribution=1">
                        <i class="icon-footNav4"></i>
                        <p>订单</p>
                    </a>
                </li>
                <li>
                    <a href="/mybill/WalletDetail?type=1">
                        <i class="icon-footNav2"></i>
                        <p>账单</p>
                    </a>
                </li>
            </ul>
        </div>
    }

    <a class="goTop">
        <img src="~/Content/css/tokenmall/img/icon/goTop.png" />
    </a>

    <link href="~/Scripts/mescroll/mescroll.min.css" rel="stylesheet" />
    <script src="~/Scripts/mescroll/mescroll.min.js"></script>
    <script type="text/javascript">
        $(function () {
            var status = 0;
            var mescroll = new MeScroll("mescroll", {
                down: {
                    auto: false,
                    callback: function (mescroll) {
                        mescroll.resetUpScroll(); //下拉刷新的回调,默认重置上拉加载列表为第一页
                    }
                },
                up: {
                    callback: getListData,
                    clearEmptyId: "order",
                    isBounce: false,
                    noMoreSize: 3,
                    htmlNodata: '<p class="upwarp-nodata">--没有更多数据了 --</p >',
                    empty: {
                        warpId: "order",
                        icon: "",
                        tip: "亲,没有您要找的订单~"

                    },
                    toTop: {
                        html: '<a class="goTop" style="display: inline;"><img src="../Content/css/tokenmall/img/icon/goTop.png" /></a>',
                        offset: 500
                    }
                }
            });

            function getListData(page) {
                $.ajax({
                    type: 'post',
                    url: '/MyOrder/_SellerOrderList',
                    data: { page: page.num, size: page.size, order_status: status, isOnlyShowDistribution:'@isOnlyShowDistribution' ,type:@type},
                    success: function (response) {
                        var paged = $(response).siblings("page");
                        var rows = Number.parseInt(paged.attr("rows"));
                        var total = Number.parseInt(paged.attr("total_result"));
                        mescroll.endBySize(rows, total);
                        if (paged.length === 1) {
                            $("#order").append($(response));
                            $('#order page').remove();
                        }

                    },
                    error: function (e) {
                        //联网失败的回调,隐藏下拉刷新和上拉加载的状态
                        mescroll.endErr();
                    }
                });
            }

            $("ul#status").on("click", "li", function () {
                //只需要找到你点击的是哪个ul里面的就行
                $(this).addClass("cur").siblings().removeClass("cur");
                status = $(this).val();
                //重置列表数据
                mescroll.resetUpScroll();
                //隐藏回到顶部按钮
                mescroll.hideTopBtn();
            });

        });

    </script>
</body>
<style>
    .mescroll-totop img {
        max-width: 100%;
    }
</style>



